package com.example.aicloud.util;


import com.example.aicloud.entity.SecurityUserDetails;
import org.springframework.security.core.context.SecurityContextHolder;

public class SecutiryUtil {

    /**
     * 得到当前登录用户
     * @return
     */
    public static SecurityUserDetails getCurrentUser() {
        SecurityUserDetails userDetails = null;
        try {
            userDetails = (SecurityUserDetails)SecurityContextHolder.getContext()
                    .getAuthentication().getPrincipal();
        }catch (Exception e) {
        }
        return userDetails;
    }

}